Field of the Invention
The present invention relates to an image processing apparatus, a method of controlling the same, and a storage medium.
Description of the Related Art
Conventionally, in the field of computer vision and the like, it is demanded to obtain distance information from a picked-up image.
For example, there has been disclosed a technique for estimating distance information by searching for correspondence points from a plurality of images having parallax, using the correlation between them (see e.g. Japanese Patent Laid-Open Publication No. H06-74762, and “Learning OpenCV” by Gary Bradski and Adrian Kaehler), Oreilly & Associates Inc. (Oct. 3, 2008)).
Further, there has been disclosed a technique for estimating distance information by calculating an amount of change in the degree of focus from a plurality of images which are different in focal position (see e.g. Japanese Patent Laid-Open Publication No. 2010-183174).
Japanese Patent Laid-Open Publication No. H06-74762 further discloses a technique in which distance information estimation is performed, so to accurately estimate distance information even with respect to an object which is out of the depth of field of an optical imaging system, by picking up images in a plurality of focal positions to thereby prevent such an object from being out of the depth of field.
FIG. 21 is a diagram useful in explaining a plurality of focal positions. In FIG. 21, a distance measurement device 9117 picks up a plurality of images having parallax therebetween. The depth of field of an optical imaging system of the distance measurement device 9117 is calculated by the following equations (1) to (3):
                              D          f                =                              r            ·            Av            ·                          Z              2                                                          f              2                        +                          r              ·              Av              ·              Z                                                          (        1        )                                          D          b                =                              r            ·            Av            ·                          Z              2                                                          f              2                        -                          r              ·              Av              ·              Z                                                          (        2        )                                D        =                              D            f                    +                      D            b                                              (        3        )            
wherein Df represents front depth of field, Db represents rear depth of field, D represents depth of field, r represents a diameter of a permissible circle of confusion, Av represents an aperture value, Z represents an object distance, and f represents a focal length.
For example, let it be assumed that the diameter of the permissible circle of confusion is 0.03328 mm, the aperture value is set to 2.8, and the focal length is set to 50 mm, and that a plurality of focal positions are determined such that there is no object which is out of the depth of field within a range of distance of 1 m to 20 m. At this time, the ranges of the depth of field corresponding to the respective focal positions are indicated by arrows shown in FIG. 21 from the above equations (1) and (2). The arrows in FIG. 21, denoted by reference numerals 9101 to 9116, indicate boundaries between the respective ranges of the depth of field.
However, in the conventional technique disclosed in Japanese Patent Laid-Open Publication No. H06-74762, the number of focal positions for distance measurement is increased depending on the aperture value of the optical imaging system of the distance measurement device or the distance range of distance measurement, causing an increase in processing time.
For example, in a case where the number of focal positions for distance measurement is fifteen as in an example shown in FIG. 21, the conventional technique is unsuitable for an apparatus which is required to have immediacy, such as a digital camera.
Further, the conventional technique disclosed in “Learning OpenCV” by Gary Bradski and Adrian Kaehler, Oreilly & Associates Inc. (Oct. 3, 2008) cannot accurately estimate distance information with respect to an object which is out of the depth of field of the optical imaging system.
Further, in the conventional technique disclosed in Japanese Patent Laid-Open Publication No. 2010-183174, the depth of field increases depending on the aperture value of the optical imaging system of the distance measurement device or the distance range of distance measurement, and an amount of change in the degree of focus dependent on a difference in focal position is reduced, which reduces the accuracy of distance.